import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Balapod here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Balapod extends Bala
{
    /**
     * Act - do whatever the Balapod wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
       move();
        }
    
    /**
     * Se sobrecarga el metodo move, y lo que hace es checar intersecciones con los demas objetos.
     */
    void move()
    {
        Actor ene = getOneIntersectingObject(Enemigo1.class);
        Actor ene2 = getOneIntersectingObject(Enemigo2.class);
        Actor ene3 = getOneIntersectingObject(Enemigo3.class);
        Actor pc = getOneIntersectingObject(PC.class);
        x=getX();
        y=getY()-5;
        setLocation(x,y);
        if (getY()<10||ene!=null||ene2!=null||ene3!=null||pc!=null)
        {
            getWorld().removeObject(this);
        }
    }
}
